/**
 * 
 */
package com.easidea.tim.entity.system.permission;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToMany;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.springside.core.dao.extend.Undeletable;

import com.easidea.tim.entity.BaseEntity;

/**
 * 权限点
 * @author Harrison
 *
 */
@Entity(name="tim_permission_permission")
@org.hibernate.annotations.Entity(dynamicInsert=true,dynamicUpdate=true)
@Cache(region="tim_permission_permission",usage=CacheConcurrencyStrategy.READ_WRITE)
@Undeletable(status="deleted")
public class Permission extends BaseEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = 8446808991292995885L;
	
	private String name; //权限点名称
	private String uri; //权限点的入口URI，非参数部分
	private List<Role> roles; // 角色列表
	
	
	/**
	 * @return the name
	 */
	@Column(name="name", nullable=false)
	public String getName() {
		return name;
	}
	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}
	/**
	 * @return the uri
	 */
	@Column(name="uri", nullable=false)
	public String getUri() {
		return uri;
	}
	/**
	 * @param uri the uri to set
	 */
	public void setUri(String uri) {
		this.uri = uri;
	}
	/**
	 * @return the roles
	 */
	@ManyToMany(fetch=FetchType.LAZY,mappedBy="permissions")
	public List<Role> getRoles() {
		return roles;
	}
	/**
	 * @param roles the roles to set
	 */
	public void setRoles(List<Role> roles) {
		this.roles = roles;
	}
	
}
